<!DOCTYPE>
<html>
<meta charset=utf-8>
<head>
<script src='../trunk/Weiran.js'></script>
<script src='../trunk/Class.js'></script>
<script src='../trunk/Array.js'></script>
<script src='../trunk/Buffer.js'></script>
<script>
// constructor and toString
/*
var a = new Weiran.Buffer();
var b = new Weiran.Buffer(10);
var c = new Weiran.Buffer([]);
var d = new Weiran.Buffer([1, 2, 3, 4, 5]);
var e = new Weiran.Buffer('');
var f = new Weiran.Buffer('abcdefghijklmn');
var g = new Weiran.Buffer('abcdefghijklmn', 'hex');
var h = new Weiran.Buffer('abcdefghijklmn', 'base64');
console.log('a.toString');
console.log(a.toString());
console.log(a.toString('hex'));
console.log(a.toString('base64'));
console.log('b.toString');
console.log(b.toString());
console.log(b.toString('hex'));
console.log(b.toString('base64'));
console.log('c.toString');
console.log(c.toString());
console.log(c.toString('hex'));
console.log(c.toString('base64'));
console.log('d.toString');
console.log(d.toString());
console.log(d.toString('hex'));
console.log(d.toString('base64'));
console.log('e.toString');
console.log(e.toString());
console.log(e.toString('hex'));
console.log(e.toString('base64'));
console.log('f.toString');
console.log(f.toString());
console.log(f.toString('hex'));
console.log(f.toString('base64'));

console.log('g.toString');
console.log(g.toString());
console.log(g.toString('hex'));
console.log(g.toString('base64'));

console.log('h.toString');
console.log(h.toString());
console.log(h.toString('hex'));
console.log(h.toString('base64'));

var i = new Weiran.Buffer('abcdefghijklmnop', 'base64');
console.log('i.toString');
console.log(i.buffer);
console.log(i.toString('hex'));
console.log(i.toString('base64'));
*/

// setChar and getChar
/*
var a = new Weiran.Buffer(10);
console.log('len: ' + a.getLength());
console.log(a.buffer);
console.log(a.toString());

console.log(a.setChar('A'));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getChar());

console.log(a.setChar('B', 0));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getChar(0));

console.log(a.setChar('CD', 1));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getChar(1));

console.log(a.setChar('中', 2));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getChar(2));

console.log(a.setChar('\n', 3));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getChar(3));
*/

// setString and getString
/*
var a = new Weiran.Buffer(10);
console.log('len: ' + a.getLength());
console.log(a.buffer);
console.log(a.toString());

console.log(a.setString('ABCD', 0));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getString(0));
console.log(a.getString(0, 4));

console.log(a.setString('中文', 4));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getString(4, 6));

console.log(a.setString('ABCD中文', 0));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getString(0, 10));

console.log(a.setString('ABCD中文EFG', 0));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getString(0, 13));

console.log(a.setString('AB中\nCD', 0));
console.log(a.buffer);
console.log(a.toString(''));
console.log(a.toString('base64'));
console.log(a.getString(0, 10));
*/

// setUInt8 and getUInt8
/*
var a = new Weiran.Buffer(10);
console.log('len: ' + a.getLength());
console.log(a.buffer);
console.log(a.toString());

console.log(a.setUInt8(127, 0));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getUInt8(0));

console.log(a.setUInt8(255, 0));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getUInt8(0));

console.log(a.setUInt8(-0, 0));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getUInt8(0));

console.log(a.setUInt8(256, 0));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getUInt8(0));

console.log(a.setUInt8(-1, 0));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getUInt8(0));
*/

// setUInt16 and getUInt16
/*
var a = new Weiran.Buffer(10);
console.log('len: ' + a.getLength());
console.log(a.buffer);
console.log(a.toString());

console.log(a.setUInt16(0xff, 0));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getUInt16(0));

console.log(a.setUInt16(0xffff, 0));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getUInt16(0));

console.log(a.setUInt16(-0, 0));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getUInt16(0));

console.log(a.setUInt16(0x80000, 0));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getUInt16(0));

console.log(a.setUInt16(-1, 0));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getUInt16(0));
*/

// setUInt32 and getUInt32
/*
var a = new Weiran.Buffer(10);
console.log(a.buffer);
console.log(a.toString());

console.log(a.setUInt32(0x12345678, 2));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getUInt32(2));

console.log(a.setUInt32(-0, 2));
console.log(a.toString());
console.log(a.getUInt32(2));

console.log(a.setUInt32(0x12345678, 2, true));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getUInt32(2, true));
*/

// setInt8 and getInt8
/*
var a = new Weiran.Buffer(10);

console.log(a.setInt8(127, 0));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getInt8(0));

console.log(a.setInt8(255, 1));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getInt8(1));

console.log(a.setInt8(-0, 2));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getInt8(3));

console.log(a.setInt8(-128, 3));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getInt8(3));

console.log(a.setInt8(-129, 4));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getInt8(4));
*/

// setInt16 and getInt16
/*
var a = new Weiran.Buffer(10);

console.log(a.setInt16(0xff, 0));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getInt16(0));

console.log(a.setInt16(0xffff, 0));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getInt16(0));

console.log(a.setInt16(-0, 0));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getInt16(0));

console.log(a.setInt16(0x1234, 4, true));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getInt16(4, true));

console.log(a.setInt16(-0x1234, 4, true));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getInt16(4, true));
*/

// setInt32 and getInt32
/*
var a = new Weiran.Buffer(10);

console.log(a.setInt32(0x12345678, 2));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getInt32(2));

console.log(a.setInt32(0x12345678, 2, true));
console.log(a.toString());
console.log(a.getInt32(2, true));

console.log(a.setInt32(-0x12345678, 2, true));
console.log(a.buffer);
console.log(a.toString());
console.log(a.getInt32(2, true));
*/

// setFloat and getFloat
var a = new Weiran.Buffer(10);
console.log(Math.PI);

console.log(a.setFloat(Math.PI, 0));
console.log(a.toString());
console.log(a.getFloat(0));

console.log(a.setFloat(Math.PI, 4, true));
console.log(a.toString());
console.log(a.getFloat(4, true));

console.log(a.setFloat(-Math.PI, 0));
console.log(a.toString());
console.log(a.getFloat(0));

// setDouble and getDouble
console.log(a.setDouble(Math.PI, 0));
console.log(a.toString());
console.log(a.getDouble(0));

console.log(a.setDouble(Math.PI, 0, true));
console.log(a.toString());
console.log(a.getDouble(0, true));

console.log(a.setDouble(-Math.PI, 2));
console.log(a.toString());
console.log(a.getDouble(2));
</script>
</head>
<body>
</body>
</html>
